home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / mdishe / helptip.bas < prev    next >
BASIC Source File  |  1994-12-27  |  4KB  |  110 lines

  1. ' ********************************************************
  2. '        MDI Standard Application Shell
  3. ' ********************************************************
  4. '
  5. ' SUMMARY
  6. ' -------
  7. ' This file is part of an MDI application "skeleton"
  8. ' created by John Blessing of Leigh Business Enterprises Ltd.
  9. '
  10. ' FEATURES
  11. ' --------
  12. ' Selection of application database.
  13. ' Compact/Repair of database.
  14. ' 'Helptips' on toolbar items.
  15. ' Support for Help files.
  16. ' MDI child forms tiling etc.
  17. ' Error trapping.
  18. ' 'Nag' screen support for shareware authors.
  19. ' Support for 3D dialogs (switched off in design mode
  20. '   to prevent GPFs)
  21. '
  22. ' USE
  23. ' ---
  24. ' You need VB Pro to use this shell, although it could be
  25. ' modified to run under the standard edition.
  26. '
  27. ' You will need to set up some information in APP.BAS,
  28. ' particularly in SetAppInfo().  You will also need to add
  29. ' your own application specific code to this module.
  30. '
  31. ' DISTRIBUTION
  32. ' ------------
  33. ' This program is "FreeWare" and may be used and distributed
  34. ' as you wish.
  35. '
  36. ' It incorporates some ideas/code from other authors and these
  37. ' are acknowledged in the appropriate module.
  38. '
  39. ' We hope that you will find it useful.  If you wish to discuss it
  40. ' then please e-mail us on Compuserve 100444,623.
  41. '
  42. ' ADVERTISEMENT!
  43. ' --------------
  44. ' Are you looking for a helpdesk system? Or does your company
  45. ' want to track and monitor the progress of any work activity?
  46. ' We market a system which could be of interest to you.
  47. '
  48. ' PROGRESS is available for download from the Business section
  49. ' of the Windows Shareware forum on Compuserve
  50. ' (filename PRGRSS10.ZIP).  It's a large program, so in the
  51. ' same section you will also find the help files and
  52. ' documentation as  PRGSSDOC.ZIP which is quicker to download
  53. ' and will give you a good idea of the functionality of PROGRESS.
  54. '
  55. ' Dec 1994
  56. '
  57. 'This function is a modified version of one downloaded from Compuserve, but
  58. 'I don't know the original author.
  59. Option Explicit
  60.  
  61. ' Subroutine to show popup help for a toolbar button
  62. ' To use:
  63. '    add a label to the form
  64. '    Set toolbar button tag property to help message desired
  65. '    Copy this subroutine to the form code and uncomment code below
  66. '    In mousemove event of control add
  67. '       HelpTip Index, label-name, x, y
  68. '    In click event or other events of control that cause action add
  69. '       HelpTip Index, label-name, 0, 0     ' Hides help
  70. Sub HelpTip (Index As Integer, HelpLabel As Label, px As Single, py As Single)
  71.  
  72.     Dim maxx As Single, maxy As Single
  73.     Dim nPnlTop As Single, nPnlLeft As Single
  74.     
  75.     ' Determine max x & y coordinates with 80 twip border
  76.     ' boundry of 80 twips allowed to be able to catch cursor as exiting control
  77.     maxx = mdiMain!Toolbar(Index).Width - 80
  78.     maxy = mdiMain!Toolbar(Index).Height - 80
  79.     ' if exiting control area turn off help panel
  80.     If px < 80 Or py < 80 Or px > maxx Or py > maxy Then
  81.         HelpLabel.Visible = False
  82.         HelpLabel.Caption = ""
  83.         Exit Sub
  84.     End If
  85.     
  86.     ' get help msg from control's tag and
  87.     HelpLabel.Caption = mdiMain!Toolbar(Index).Tag
  88.  
  89.     ' Determine location for help panel
  90.     ' Assume to the right of the last toolbar button
  91.     nPnlTop = mdiMain!Toolbar(Index).Top
  92.     nPnlLeft = mdiMain!Toolbar(0).Left + (mdiMain!Toolbar(Index).Width * (tGApp.iToolButtonCount)) + 40
  93.     ' Put panel to left of first toolbar button if not enough room
  94.     If nPnlLeft + HelpLabel.Width > HelpLabel.Parent.ScaleWidth Then
  95.         nPnlLeft = mdiMain!Toolbar(0).Left - HelpLabel.Width - 40
  96.     End If
  97.  
  98.     ' if same settings exit to prevent flickering effect
  99.     If HelpLabel.Caption = mdiMain!Toolbar(Index).Tag And HelpLabel.Top = nPnlTop And HelpLabel.Left = nPnlLeft Then
  100.         Exit Sub
  101.     End If
  102.     
  103.     'position help panel
  104.     HelpLabel.Top = nPnlTop
  105.     HelpLabel.Left = nPnlLeft
  106.     HelpLabel.Visible = True
  107.     
  108. End Sub
  109.  
  110.